import request from '@/utils/request'
import { HTTP_METHOD } from '@/utils/http'

const BASE_URL = '/auth'

/**
 * 用户登录
 * @param {*} mobile
 * @param {*} code
 * @param {*} remember_me
 * @return {*}
 */
export function postLogin (data) {
  return request({
    url: `${BASE_URL}/login/pwd`,
    method: HTTP_METHOD.POST,
    data,
  })
}

export function getSmsCaptcha (parameter) {
  return request({
    url: '/message/sms',
    method: 'post',
    data: parameter,
  })
}

/**
 * 获取用户信息
 * @param {`*`} token
 */
export function getInfo () {
  return request({
    url: `${BASE_URL}/info`,
    method: HTTP_METHOD.GET,
  })
}

/**
 * @export 退出登录
 * @return {*}
 */
export function logout () {
  return request({
    url: `${BASE_URL}/logout`,
    method: HTTP_METHOD.POST,
  })
}
